<template>
  <div>
    <basic-table
      :table-title="tableTitle"
      :data-source="dataSource"
      :data-params="dataParams"
      :multiple-table="false"
      class="mt-4"
    >
      <template v-slot:check="scope">
        <span style="color: #0087FE; cursor: pointer;" @click="changeStatus(scope.row)">
          查看
        </span>
      </template>
    </basic-table>

    <Modal
      :show="dialogVisible"
      :descriptions-info="descInfo"
      :descriptions-list="descriptionsList"
      @close="close"
    />
  </div>
</template>
<script>
import BasicTable from '@/components/BasicTable/index.vue'
import Modal from '@/components/Modal/Index'

import { getSceneCheckInfo, getSceneCheckDetail } from '@/api/project'

export default {
  name: 'BasicInfos',
  components: { BasicTable, Modal },
  props: {
    projectId: { type: String, default: '' }
  },
  data() {
    return {
      dataSource: () => getSceneCheckInfo,
      dataParams: {},
      dialogVisible: false,
      tableTitle: [
        {
          label: '工程名称',
          value: 'ProName',
          show: true,
          type: 'text'
        },
        {
          label: '检查人',
          value: 'CheckPer',
          show: true,
          type: 'text'
        },
        {
          label: '检查时间',
          value: 'CheckDate',
          show: true,
          type: 'text'
        },
        {
          label: '检查结论',
          value: 'CheckResult',
          show: true,
          type: 'text'
        },
        {
          label: '整改结果',
          value: 'ImproveResult',
          show: true,
          type: 'text'
        },
        {
          label: '施工许可证编号',
          value: 'BuildPermitNum',
          show: true,
          type: 'text'
        },
        {
          label: '详情',
          show: true,
          type: 'slot',
          slot: 'check'
        }
      ],
      descriptionsList: {
        'BuildPermitNum': '施工许可证编号',
        'ProjectName': '工程名称',
        'CheckPer': '检查人',
        'CheckDate': '检查时间',
        'SpotHead': '现场负责人',
        'CreatePer': '登记人',
        'CreateDate': '登记时间',
        'TocheckCom': '涉及单位',
        'CheckContent': '检查内容描述',
        'CheckResult': '检查结论',
        'DealAdvice': '处理意见',
        'ImproveAdvice': '整改意见',
        'ImproveResult': '整改结果'
      },
      descInfo: null
    }
  },
  created() {
    this.dataParams.projectId = this.projectId
  },
  methods: {
    close(v) {
      this.dialogVisible = v
    },
    //
    changeStatus(v) {
      getSceneCheckDetail({
        id: v.Id,
        projectId: this.projectId
      }).then(res => {
        if (res.code === 200) {
          this.dialogVisible = true
          this.descInfo = res.data.detail
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
